package com.gzc.just.play.last.war.sceneserver.effect;

/**
 * 状态异常类型枚举
 *
 * 定义所有游戏中可能出现的异常状态，如眩晕、中毒、减速等
 *
 * 对应C++的 SSPassitiveEffect 相关状态
 *
 * @author AI编程助手
 * @version 1.0
 * @since 2025-11-22
 */
public enum StatusType {
    // 控制类状态
    STUN("眩晕", "无法行动和使用技能", 1),
    SILENCE("沉默", "无法使用技能", 2),
    FREEZE("冻结", "移动速度降为0", 3),
    KNOCK_BACK("击退", "被击退到远处", 4),
    ROOT("禁锢", "无法移动", 5),
    POLYMORPH("变形", "属性临时改变", 6),
    
    // 伤害类状态
    POISON("中毒", "持续受到伤害", 10),
    BURN("灼烧", "持续受到伤害且传播", 11),
    BLEED("流血", "失血持续伤害", 12),
    CURSE("诅咒", "受伤加重", 13),
    DISEASE("疾病", "属性下降", 14),
    
    // 减速类状态
    SLOW("减速", "移动速度降低", 20),
    WEAKNESS("虚弱", "攻击力降低", 21),
    FRAGILE("脆弱", "受伤增加", 22),
    VULNERABLE("易伤", "防御力下降", 23),
    EXPOSED("暴露", "暴击率增加", 24),
    
    // 增益类状态
    SHIELD("护盾", "受伤减少", 30),
    REGENERATION("再生", "持续回复生命", 31),
    HASTE("加速", "移动速度提升", 32),
    POWER("力量", "攻击力提升", 33),
    INVULNERABLE("无敌", "无法受伤", 34),
    INVISIBILITY("隐身", "对敌方隐身", 35),
    
    // 其他状态
    SLEEP("睡眠", "处于睡眠状态", 40),
    FEAR("恐惧", "逃离敌方", 41),
    CHARM("魅惑", "控制目标行为", 42),
    BLIND("致盲", "无法看到周围", 43),
    NONE("无状态", "正常状态", 0);
    
    private final String displayName;
    private final String description;
    private final int typeId;
    
    StatusType(String displayName, String description, int typeId) {
        this.displayName = displayName;
        this.description = description;
        this.typeId = typeId;
    }
    
    public String getDisplayName() {
        return displayName;
    }
    
    public String getDescription() {
        return description;
    }
    
    public int getTypeId() {
        return typeId;
    }
    
    /**
     * 判断是否为控制类状态（会禁止行动）
     */
    public boolean isCrowdControl() {
        return this == STUN || this == SILENCE || this == FREEZE || 
               this == KNOCK_BACK || this == ROOT || this == POLYMORPH;
    }
    
    /**
     * 判断是否为伤害类状态（会造成持续伤害）
     */
    public boolean isDamageable() {
        return this == POISON || this == BURN || this == BLEED || 
               this == CURSE || this == DISEASE;
    }
    
    /**
     * 判断是否为减速类状态
     */
    public boolean isDebuff() {
        return this == SLOW || this == WEAKNESS || this == FRAGILE || 
               this == VULNERABLE || this == EXPOSED;
    }
    
    /**
     * 判断是否为增益类状态
     */
    public boolean isBuff() {
        return this == SHIELD || this == REGENERATION || this == HASTE || 
               this == POWER || this == INVULNERABLE || this == INVISIBILITY;
    }
    
    /**
     * 根据状态ID获取对应的状态类型
     */
    public static StatusType getByTypeId(int typeId) {
        for (StatusType type : StatusType.values()) {
            if (type.typeId == typeId) {
                return type;
            }
        }
        return NONE;
    }
}
